using System;
using System.Xml.Serialization;

namespace Se.Framework.Common.Config.Urls
{
    [Serializable]
    [XmlType("UrlQueryStringStatic")]
    [XmlRoot(ElementName = "UrlQueryStringStatic")]
    public class UrlQueryStringStatic : UrlQueryStringPart
    {
        [XmlAttribute]
        public override bool Required
        {
            get
            {
                return false;
            }
            set
            {
            }
        }

        [XmlAttribute]
        public override string Value
        {
            get
            {
                return base.Value;
            }
            set
            {
                if (base.Value != null)
                {
                    throw new InvalidOperationException(string.Format("Cannot set the a ReadOnly value, Key:{0}", Key));
                }

                base.Value = value;
            }
        }

        public override UrlSection Clone()
        {
            return new UrlQueryStringStatic
            {
                Key = Key,
                Order = Order,
                Required = Required,
                Value = Value
            };
        }
    }
}